<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/11/12 0012
  Time: 14:01
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户登入</title>
	<link rel="stylesheet" href="${pageContext.request.contextPath }/css/login.css">
	<!--引入Bootstrap资源-->
	<!-- 新 Bootstrap 核心 CSS 文件 -->
<%--	<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>--%>
<%--	<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->--%>
<%--	<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">--%>
<%--	<!-- 可选的 Bootstrap 主题文件（一般不用引入） -->--%>
<%--	<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">--%>
<%--	<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->--%>
<%--	<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>--%>
	<link rel="stylesheet" href="../css/login.css">
	<script type="text/javascript">
		function changeImg() {
			var img = document.getElementById("img");
			img.src = "/verificationCode?date=" + new Date();
		}

		function checkVerificationCode() {
			var verificationCode = document.getElementById('verificationCode').value;
			var flag = (getCookie('v_c_v') == verificationCode);
			if (!flag) {
				alert('验证码输入错误');
			}
			return flag;
		}

		function getCookie(cookie_name) {
			var allCookies = document.cookie;
			var cookie_pos = allCookies.indexOf(cookie_name);   //如果找到了索引，就代表cookie存在
			if (cookie_pos != -1) {
				cookie_pos += cookie_name.length + 1;
				var cookie_end = allCookies.indexOf(";", cookie_pos);
				if (cookie_end == -1) {
					cookie_end = allCookies.length;
				}
				return unescape(allCookies.substring(cookie_pos, cookie_end));
			}
			return null;
		}
	</script>
</head>
<body>
		   <div class="login">
			   <div class="header">
				   <h1><a href="/" style="background: #222222;color: #ffffff;float: right" >毒</a></h1>
				   <h1>
					   <a href="/jsp/login.jsp">登录</a>
					   <a href="/jsp/register.jsp">注册</a>
				   </h1>
			   </div>
			   <form action="/login" method="post">
				   <div class="name">
					   <input type="text" id="name" name="username" placeholder="请输入登录用户名">
					   <p></p>
				   </div>
				   <div class="pwd">
					   <input type="password" id="pwd" name="password" placeholder="6-16位密码，区分大小写，不能用空格">
					   <p></p>
				   </div>
				   <div class="idcode">
					   <input type="text" id="verificationCode" placeholder="请输入验证码">
					   <a href='#' onclick="javascript:changeImg()">&nbsp;换一张</a>
					   <span><img id="img" src="/verificationCode"></span>
					   <div class="clear"></div>
				   </div>
				   <div class="autoLogin">
					   <label for="">
						   <input type="checkbox" checked="checked">
						   下次自动登录
					   </label>
					   <a href="">忘记密码</a>
				   </div>
				   <div class="btn-red">
					   <input onclick="return checkVerificationCode();" type="submit" value="登    录"
							  id="login-btn">
					   <span style="color: red">
						   <%if(request.getAttribute("msg")!=null){%>
						   <%=request.getAttribute("msg") %>
						   <%}%>
			   			</span>
				   </div>
			   </form>
		   </div>

<%--           <form action="/login" method="post">--%>
<%--               <div class="divinput">--%>
<%--                   <input class="inputinfo" type="text" name="username"  placeholder="请输入登录用户名"/><br />--%>
<%--               </div>--%>
<%--               <div class="divinput">--%>
<%--                   <input class="inputinfo" type="password" name="password" placeholder="6-16位密码，区分大小写，不能用空格"/><br />--%>
<%--               </div>--%>
<%--			   <br /><br />--%>
<%--               <input type="submit" value="登录" id="btn"/><br />--%>
<%--               <input type="checkbox" />记住密码   更多<br />--%>
<%--               <a href="register.jsp">注册</a>  | 找回密码<br /><br /><br />--%>
<%--               继续访问即代表您已同意小米商城服务协议--%>
<%--               <hr/>--%>
<%--           </form>--%>
<%--       </div>--%>
<%--   </div>--%>
</body>
</html>
